<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>水平和垂直居中对齐</title>
</head>

<style>
.nav{
    display: flex;
    justify-content: center;
    align-items: center;
    width: 300px;
    height: 300px;
    background-color: rgb(180, 236, 236);
}

.content{
    width: 100px;
    height: 100px;
    background-color: pink;
}
</style>
<body>
    <div class="nav">
        <div class="content"></div>
    </div>
</body>
</html>